<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">

    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="/admin/static/h-ui.admin/css/style.css"/>

</head>
<body>


<div class="page-container">
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th width="100">ID</th>
                <th width="300">评论人</th>
                <th>评论内容</th>
                <th width="150">评论时间</th>
                <th width="80">评分</th>
                <th width="80">点赞数目</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="data" items="${dataMap}">
                <tr class="text-c">
                    <td>${data.id}</td>
                    <td><a href="#"
                           onclick="lookInfo('开发者详情','/accountAdmin/admin/accountInfo?id=${data.uid}')">${data.uid}</a>
                    </td>
                    <td>${data.contents}</td>
                    <td><fmt:formatDate value="${data.ctime}" pattern="yyyy-MM-dd HH:mm"/></td>
                    <td>${data.star}</td>
                    <td>${data.good}</td>
                    <td><a title="删除评论"
                           onclick="speak_del(this,${data.id})"
                           class="ml-5"
                           style="text-decoration:none"><i
                            class="Hui-iconfont">&#xe6e2;</i></a></td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
</div>

<!--[if lt IE 9]>
<script type="text/javascript" src="/admin/lib/html5shiv.js"></script>
<script type="text/javascript" src="/admin/lib/respond.min.js"></script>
<![endif]-->
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/admin/lib/laypage/1.2/laypage.js"></script>
<script>

    /*添加-版本*/
    function lookInfo(title, url) {
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }

    $(function () {
        $('.table-sort').dataTable({});

    });

    /*删除-评论*/
    function speak_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: 'POST',
                url: '/SoftwareAdmin/admin/delSpeakingInfo',
                data: {"id": id},
                dataType: 'json',
                success: function (data) {
                    if (data.code == 200) {
                        $(obj).parents("tr").remove();
                        layer.msg('已删除,请刷新!', {icon: 1, time: 1000});
                    } else {
                        layer.msg('删除评论失败!', {icon: 1, time: 1000});
                    }
                },
                error: function (data) {
                },
            });
        });
    }
</script>
</body>
</html>